//
//  HFButton.m
//  model
//
//  Created by caohaifeng on 16/4/6.
//  Copyright © 2016年 oooooooo. All rights reserved.
//

#import "HFButton.h"

@interface HFButton ()

@property(nonatomic,strong) UIImageView *image;
@property(nonatomic,strong) UILabel *label;

@end

@implementation HFButton

- (instancetype)init {
    if (self = [super init]) {
        [self setupUI];
    }
    return self;
}

//设置界面
- (void)setupUI {
    
    [self addSubview:self.image];
    [self addSubview:self.label];
}

- (void)setImageName:(NSString *)imageName {
    _imageName = imageName;
    self.image.image = [UIImage imageNamed:imageName];
}

- (void)setLabelString:(NSString *)labelString {
    _labelString = labelString;
    self.label.text = labelString;
}

/**
 *  懒加载
 */
//图片
- (UIImageView *)image {
    if (_image == nil) {
        _image = [[UIImageView alloc] init];
        _image.frame = CGRectMake(10, 15, 60, 60);
    }
    return _image;
}

//文案MYRGBColor(51, 51, 51, 1);
- (UILabel *)label {
    if (_label == nil) {
        _label = [[UILabel alloc]  init];
        _label.font = [UIFont systemFontOfSize:14];
        _label.textColor = [UIColor blackColor];
        _label.textAlignment = NSTextAlignmentCenter;
        _label.frame = CGRectMake(10, 85, 60, 20);
    }
    return _label;
}

@end
